const int sensorPin = D1; const int ledPin = D0; const int threshold = 500; void setup() { pinMode(ledPin, OUTPUT); pinMode(sensorPin, INPUT); Serial.begin(9600); } void loop() { int sensorValue = analogRead(sensorPin); Serial.println(sensorValue); if (sensorValue < threshold) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } delay(100); }